package com.sxtyxt.online;

import android.os.Handler;
import android.view.KeyEvent;


public class ActWelcome extends ActBase {

    @Override
    protected int getLayoutId() {
        return R.layout.welcom;
    }

    @Override
    protected void initUI() {
        super.initUI();
        if (!isTaskRoot()) {
            finish();
            return;
        }
        SystemEnv.setFinish(false);
        App.isInit = true;
        // 延时3秒左右进登录页面
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                goIntent();
            }
        }, 3000);
    }

    private void goIntent() {
        if (SystemEnv.isFirstRun()) {
            transfer(GuideActivity.class);
        } else {
            transfer(ActLogin.class);
        }
        AppManager.getAppManager().finishActivity(ActWelcome.this);
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK)
            return false;
        return super.onKeyDown(keyCode, event);
    }
}
